package com.raos.userservice.loadbalance;

import java.util.List;
import java.util.Random;

/**
 * 服务发现中的服务负载均衡接口实现
 *   随机负载实现
 *
 * @author raos
 * @emil 991207823@qq.com
 * @date 2022/9/6 21:36
 */
public class RandomLoadBalance implements LoadBalance {

    @Override
    public String select(List<String> urls) {
        int len = urls.size();
        Random random = new Random();
        return urls.get(random.nextInt(len));
    }

}